<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <title>修改密码</title>
    <link rel="stylesheet" href="__STATIC__plug/layui/css/layui.css">
    <link rel="stylesheet" href="__STATIC__admin.css">
</head>

<body class="layui-layout-body">
    <div class="layui-form">
        <input type="hidden" name="id" value="{$id}">
        <div class="layui-form-item">
            <label for="" class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="text" name="password" lay-verify="required" placeholder="请输入密码" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="" class="layui-form-label">&nbsp;</label>
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="go">立即提交</button>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="__STATIC__plug/layui/layui.js"></script>
<script>
layui.use(['element', 'jquery', 'layer','form'], function() {
    var element = layui.element,
        layer = layui.layer,
        form = layui.form,
        $ = layui.jquery;
    form.on("submit(go)",function(data){
        layer.load(1, {
            shade: [0.1,'#ddd'] //0.1透明度的白色背景
        });
        $.ajax({
            url:"{:url('administrator/editPwd')}",
            data:data.field,
            type:"POST",
            dataType:'json',
            success:function(res){
                layer.closeAll('loading');
                if( res.err == 1 ){
                    layer.msg(res.msg,{icon:5});
                    return false;
                }
                var index = parent.layer.getFrameIndex(window.name);
                layer.msg(res.msg, {icon: 1,time: 1000}, function(){
                    parent.location.reload()
                    parent.layer.close(index);
                });
            },
            error:function(){
                var index = parent.layer.getFrameIndex(window.name);
                layer.msg("ERROR", {icon: 5,time: 1000}, function(){
                    parent.location.reload()
                    parent.layer.close(index);
                });
            }
        });
    });
});
</script>
</html>